<?php
// +----------------------------------------------------------------------
// | [RhaPHP System] Copyright (c) 2017 http://www.rhaphp.com/
// +----------------------------------------------------------------------
// | [RhaPHP] 并不是自由软件,你可免费使用,未经许可不能去掉RhaPHP相关版权
// +----------------------------------------------------------------------
// | Author: Geeson <qimengkeji@vip.qq.com>
// +----------------------------------------------------------------------


namespace addons\hlapp\model;

use addons\hlapp\controller\FileCache;
use addons\hlapp\dto\PageInfo;
use think\Db;
use think\Log;
use think\Model;

class HlappMember extends CommonModel
{
    public function setPhoneAttr($value)
    {
        return trim($value);
    }
    /**
     * 人员部门一对多
     * @return \think\model\relation\HasOne
     */
    public function parts(){
        return $this->belongsTo('HlappPart','partId','id');
    }

    //查询条件
    public function whereSql(){
        $parameters = $_POST['parameters'];
        $whereSql = "";
        $i = 0;
        foreach($parameters as $k=>$v) {
            if($v && $v != ""){
                if($i > 0){
                    $whereSql = $whereSql." and ";
                }
                switch($k){
                    case "name":
                        $whereSql = $whereSql." name like '%".$v."%'";
                        $i++;
                        break;
                }
            }
        }
        return $whereSql;
    }

}